/**
 * @description: 测试模块
 * @author: zhangxin
 * @Date: 2022-11-23 14:45:22
 */
import {defineStore} from 'pinia';

export const testStore = defineStore('test', {
    state: () => ({
        id: 2001,
        name: '张三',
        age: 52,
    }),
    getters: {},
    mutations: {},
    actions: {
        increment() {
            this.age++;
        },
    },
    // 使用该插件，开启数据缓存
    persist: {
        enabled: true,
        strategies: [
            {storage: sessionStorage, paths: ['id', 'name']}, // firstName 和 lastName字段用sessionStorage存储
            {storage: localStorage, paths: ['age']}, // accessToken字段用 localstorage存储
        ],
    },
});
